#ifndef DDWND_INC
#define DDWND_INC

#include "ddraw.h"
#include "d3drmwin.h"
#include <stdio.h>
#include <windows.h>

#ifdef _DEBUG
	void DISPLAY(LPCSTR x);			// Output errors to file
#else
#define DISPLAY(x)
#endif

//Release each variable when called
#define RELEASE(x) if(x!=NULL) {x->Release(); x = NULL;}

class _PROVIR_EXT_CLASS CDDWnd
{
public:
	CDDWnd();		//Constructor
	~CDDWnd();		//Destructor

	// initialisation functions
	BOOL Create(CWnd* pWindow, BOOL bFullScreen = TRUE, int nWidth = 0, int nHeight = 0, int nDepth = 0);
	virtual void UpdateScreen();
												// Create the DirectDraw Device and Surfaces
	virtual void Release();								// release all the objects
	
	virtual BOOL CreatePalette();					// Seting the palette

	char* MyErrorToString(HRESULT error);		// output the errors to the file

protected:
	virtual void CheckLost();

// data
protected:
	LPDIRECTDRAW m_pDD;					// Direct draw device
	
	LPDIRECTDRAWCLIPPER m_pClipper;		// the clipper for the primari surface
	LPDIRECTDRAWSURFACE	m_pDDSPrimary;	// the primary surface
	LPDIRECTDRAWSURFACE	m_pDDSBack;		// the back buffer
	LPDIRECTDRAWPALETTE m_pDDPal;		// DirectDraw palette for 8bit only

	// Direct Draw Surface stuff
	BOOL m_bFullScreen;
	int m_nWidth;
	int m_nHeight;
	int m_nBpp;		//Colour Depth
	
	// The host window
	CWnd*	m_pHostWindow;
};

#endif	//DDWND_INC

